package org.ioc.com.book7.config;

import org.ioc.com.book7.model.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
public class ErrorAdvice {
    @ExceptionHandler
    public Object handler(Exception e){
        return Result.fail(e.getMessage());
    }
    @ExceptionHandler
    public Object handler1(NullPointerException e){
        return Result.fail(e.getMessage());
    }


}
